<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/include/head.jsp"%>
</head>
<body>
	<div class="formData"  align="center">
		<form id="addForm">
			<table style="width: 100%">
					<#list columnList as column>
				<tr>
					<td align="right">${column.dbColumnComment}：</td>
					<td align="left"><input type="text" id="${column.javaPropertyName}" name="${column.javaPropertyName}" style="width:100px;"></td>
				</tr>
					</#list>
			</table>
		</form>
	</div>
	<div  align="center" style="margin-top: 10px">
			<a id="addBtn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok'">保存</a>&nbsp;&nbsp;
			<a id="resetBtn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'">重置</a>
	</div>
	<script type="text/javascript">
	$(function(){
		<#list columnList as column>	
		$('#${column.javaPropertyName}').validatebox({required:true});
		</#list>
		$("#addBtn").click(function() {
				$.ajax({
					type : 'POST',
					url : "${ctx}/${simpleBeanName}/add.do",
					data : $("#addForm").serialize(),
					beforeSend:function (){
						return $("#addForm").form('validate');
					},
					success : function(data) {
						if(data.success){
							 Dialog.alert("操作成功！",function(){
								 parent.location.reload();
								 parent.dialog.close();
							 });
						}else{
							 Dialog.alert(data.msg);
						}
					},
					cache:false,
					dataType : 'json'
				});
			});

			$("#resetBtn").click(function() {
				$('#addForm').form('clear');
			});
		});
	</script>
</body>
</html>